/* JavaLog - package tracker 
 * 
 * Copyright (C) 2009  Allyson Lima, Diego Pedro, Victor Freire
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this 
 * program.  If not, see <http://www.gnu.org/licenses/>.
 */
package br.edu.ufcg.ccc.javalog.view;

import java.text.ParseException;

import javax.swing.text.MaskFormatter;

/**
 * Utility functions for View objects.
 * @author Allyson Lima, Diego Pedro, Victor Freire
 * @version 11/10/09
 */
public class ViewUtil {
	private static final String ZipcodeFormatString = "#####-###";
	
	private static MaskFormatter makeFormatter(String s) {
		MaskFormatter formatter = null;
		try {
			formatter = new MaskFormatter(s);
	    } catch (ParseException e) {
	        System.err.println("Error in zipcode formatter: " + e.getMessage());
	    }
	    return formatter;
	}
	
	public static MaskFormatter getZipcodeFormatter() {
		return makeFormatter(ZipcodeFormatString);
	}
}
